package com.briup.es.demos.web;

import com.briup.es.demos.service.UserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
/*@ResponseBody
@Controller*/
public class TestController {

    @Resource
    private UserService service;

    @RequestMapping("/a")
    public String test() {
        return "a.jpg";
    }

    //    @ResponseBody
    @RequestMapping("/user")
    public Object user() {
        return "这是一个user数据";
    }

    // SpringMVC默认会将你返回的数据去static中查询对应的视图
    // @ResponseBody注解，可以将返回的数据直接放入到响应体中，而无需经过视图渲染
//    @ResponseBody
    @RequestMapping("/login")
    public String login(String username, String password) {
        return service.login(username, password);
    }
}
